package top.kaoshanji.q1ch07a;

import top.kaoshanji.y1constant.FileConstant;

import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
import java.util.stream.Collectors;

/**
 * 代码清单-q1ch07a-328页a：缓冲输入文件
 * author kaoshanji
 * ^_^
 * create time 2025/3/12 11:23
 */
public class BufferedInputFile {

    static String pathStr = FileConstant.LOCAL_ROOT_PATH.concat("q1ch07a328页a\\");

    public static void main(String[] args) {

        System.out.println(read(pathStr.concat("BufferedInputFile.java")));

    }

    public static String read(String fileName) {

        try (BufferedReader in = new BufferedReader(new FileReader(fileName))) {
            return in.lines().collect(Collectors.joining("\n"));
        } catch (IOException e) {
            throw new RuntimeException(e);
        }

    }



}
